package org.dtrd.modules.ocr.entity.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;
import lombok.Getter;
import lombok.Setter;
import org.dtrd.modules.ocr.entity.bean.OcrMappingDetail;


/**
 * <p>
 * 
 * </p>
 *
 * @author sun
 * @since 2022-09-06
 */
@Getter
@Setter
@TableName("dtrd_ent_rd_ocr_mapping")
public class DtrdEntRdOcrMapping {

    @TableId(value = "data_id", type = IdType.AUTO)
    private Integer dataId;

    /**
     * 关键字
     */
    @TableField("word")
    private String word;

    /**
     * 映射实体
     */
    @TableField("mapping_entity")
    private String mappingEntity;

    /**
     * 映射字段
     */
    @TableField("mapping_field")
    private String mappingField;


    /**
     * 映射字段
     */
    @TableField("mapping_text")
    private String mappingText;

    @TableField("create_time")
    private Date createTime;

    @TableField("is_del")
    @TableLogic
    private Integer isDel;

    public DtrdEntRdOcrMapping init() {
        createTime = new Date();
        isDel = 0;
        return this;
    }

    public DtrdEntRdOcrMapping parseFromDto(OcrMappingDetail dto) {
        dataId = dto.getDataId();
        word = dto.getWord();
        mappingEntity = dto.getMappingEntity();
        mappingField = dto.getMappingField();
        mappingText = dto.getMappingText();
        return this;
    }


}
